home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIHttpAuthenticator.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  11KB  |  235 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIHttpAuthenticator.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIHttpAuthenticator_h__
  6. #define __gen_nsIHttpAuthenticator_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIHttpChannel; /* forward declaration */
  18.  
  19.  
  20. /* starting interface:    nsIHttpAuthenticator */
  21. #define NS_IHTTPAUTHENTICATOR_IID_STR "0f331436-8bc8-4c68-a124-d0253a19d06f"
  22.  
  23. #define NS_IHTTPAUTHENTICATOR_IID \
  24.   {0x0f331436, 0x8bc8, 0x4c68, \
  25.     { 0xa1, 0x24, 0xd0, 0x25, 0x3a, 0x19, 0xd0, 0x6f }}
  26.  
  27. /**
  28.  * nsIHttpAuthenticator
  29.  *
  30.  * Interface designed to allow for pluggable HTTP authentication modules.
  31.  * Implementations are registered under the ContractID:
  32.  *
  33.  *   "@mozilla.org/network/http-authenticator;1?scheme=<auth-scheme>"  
  34.  *
  35.  * where <auth-scheme> is the lower-cased value of the authentication scheme
  36.  * found in the server challenge per the rules of RFC 2617.
  37.  */
  38. class NS_NO_VTABLE nsIHttpAuthenticator : public nsISupports {
  39.  public: 
  40.  
  41.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTTPAUTHENTICATOR_IID)
  42.  
  43.   /**
  44.      * Upon receipt of a server challenge, this function is called to determine
  45.      * whether or not the current user identity has been rejected.  If true,
  46.      * then the user will be prompted by the channel to enter (or revise) their
  47.      * identity.  Following this, generateCredentials will be called.
  48.      *
  49.      * If the IDENTITY_IGNORED auth flag is set, then the aInvalidateIdentity
  50.      * return value will be ignored, and user prompting will be suppressed.
  51.      *
  52.      * @param aChannel
  53.      *        the http channel that received the challenge.
  54.      * @param aChallenge
  55.      *        the challenge from the WWW-Authenticate/Proxy-Authenticate
  56.      *        server response header.  (possibly from the auth cache.)
  57.      * @param aProxyAuth
  58.      *        flag indicating whether or not aChallenge is from a proxy.
  59.      * @param aSessionState
  60.      *        see description below for generateCredentials.
  61.      * @param aContinuationState
  62.      *        see description below for generateCredentials.
  63.      * @param aInvalidateIdentity
  64.      *        return value indicating whether or not to prompt the user for a
  65.      *        revised identity.
  66.      */
  67.   /* void challengeReceived (in nsIHttpChannel aChannel, in string aChallenge, in boolean aProxyAuth, inout nsISupports aSessionState, inout nsISupports aContinuationState, out boolean aInvalidatesIdentity); */
  68.   NS_IMETHOD ChallengeReceived(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, nsISupports **aSessionState, nsISupports **aContinuationState, PRBool *aInvalidatesIdentity) = 0;
  69.  
  70.   /**
  71.      * Called to generate the authentication credentials for a particular
  72.      * server/proxy challenge.  This is the value that will be sent back
  73.      * to the server via an Authorization/Proxy-Authorization header.
  74.      *
  75.      * This function may be called using a cached challenge provided the
  76.      * authenticator sets the REUSABLE_CHALLENGE flag.
  77.      *
  78.      * @param aChannel
  79.      *        the http channel requesting credentials
  80.      * @param aChallenge
  81.      *        the challenge from the WWW-Authenticate/Proxy-Authenticate
  82.      *        server response header.  (possibly from the auth cache.)
  83.      * @param aProxyAuth
  84.      *        flag indicating whether or not aChallenge is from a proxy.
  85.      * @param aDomain
  86.      *        string containing the domain name (if appropriate)
  87.      * @param aUser
  88.      *        string containing the user name
  89.      * @param aPassword
  90.      *        string containing the password
  91.      * @param aSessionState
  92.      *        state stored along side the user's identity in the auth cache
  93.      *        for the lifetime of the browser session.  if a new auth cache
  94.      *        entry is created for this challenge, then this parameter will
  95.      *        be null.  on return, the result will be stored in the new auth
  96.      *        cache entry.  this parameter is non-null when an auth cache entry
  97.      *        is being reused.
  98.      * @param aContinuationState
  99.      *        state held by the channel between consecutive calls to
  100.      *        generateCredentials, assuming multiple calls are required
  101.      *        to authenticate.  this state is held for at most the lifetime of
  102.      *        the channel.
  103.      */
  104.   /* string generateCredentials (in nsIHttpChannel aChannel, in string aChallenge, in boolean aProxyAuth, in wstring aDomain, in wstring aUser, in wstring aPassword, inout nsISupports aSessionState, inout nsISupports aContinuationState); */
  105.   NS_IMETHOD GenerateCredentials(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, const PRUnichar *aDomain, const PRUnichar *aUser, const PRUnichar *aPassword, nsISupports **aSessionState, nsISupports **aContinuationState, char **_retval) = 0;
  106.  
  107.   /**
  108.      * Flags defining various properties of the authenticator.
  109.      */
  110.   /* readonly attribute unsigned long authFlags; */
  111.   NS_IMETHOD GetAuthFlags(PRUint32 *aAuthFlags) = 0;
  112.  
  113.   /**
  114.      * A request based authentication scheme only authenticates an individual
  115.      * request (or a set of requests under the same authentication domain as
  116.      * defined by RFC 2617).  BASIC and DIGEST are request based authentication
  117.      * schemes.
  118.      */
  119.   enum { REQUEST_BASED = 1U };
  120.  
  121.   /**
  122.      * A connection based authentication scheme authenticates an individual
  123.      * connection.  Multiple requests may be issued over the connection without
  124.      * repeating the authentication steps.  Connection based authentication
  125.      * schemes can associate state with the connection being authenticated via
  126.      * the aContinuationState parameter (see generateCredentials).
  127.      */
  128.   enum { CONNECTION_BASED = 2U };
  129.  
  130.   /**
  131.      * The credentials returned from generateCredentials may be reused with any
  132.      * other URLs within "the protection space" as defined by RFC 2617 section
  133.      * 1.2.  If this flag is not set, then generateCredentials must be called
  134.      * for each request within the protection space.  REUSABLE_CREDENTIALS
  135.      * implies REUSABLE_CHALLENGE.
  136.      */
  137.   enum { REUSABLE_CREDENTIALS = 4U };
  138.  
  139.   /**
  140.      * A challenge may be reused to later generate credentials in anticipation
  141.      * of a duplicate server challenge for URLs within "the protection space"
  142.      * as defined by RFC 2617 section 1.2.
  143.      */
  144.   enum { REUSABLE_CHALLENGE = 8U };
  145.  
  146.   /**
  147.      * This flag indicates that the identity of the user is not required by
  148.      * this authentication scheme.
  149.      */
  150.   enum { IDENTITY_IGNORED = 1024U };
  151.  
  152.   /**
  153.      * This flag indicates that the identity of the user includes a domain
  154.      * attribute that the user must supply.
  155.      */
  156.   enum { IDENTITY_INCLUDES_DOMAIN = 2048U };
  157.  
  158. };
  159.  
  160. /* Use this macro when declaring classes that implement this interface. */
  161. #define NS_DECL_NSIHTTPAUTHENTICATOR \
  162.   NS_IMETHOD ChallengeReceived(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, nsISupports **aSessionState, nsISupports **aContinuationState, PRBool *aInvalidatesIdentity); \
  163.   NS_IMETHOD GenerateCredentials(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, const PRUnichar *aDomain, const PRUnichar *aUser, const PRUnichar *aPassword, nsISupports **aSessionState, nsISupports **aContinuationState, char **_retval); \
  164.   NS_IMETHOD GetAuthFlags(PRUint32 *aAuthFlags); \
  165.  
  166. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  167. #define NS_FORWARD_NSIHTTPAUTHENTICATOR(_to) \
  168.   NS_IMETHOD ChallengeReceived(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, nsISupports **aSessionState, nsISupports **aContinuationState, PRBool *aInvalidatesIdentity) { return _to ChallengeReceived(aChannel, aChallenge, aProxyAuth, aSessionState, aContinuationState, aInvalidatesIdentity); } \
  169.   NS_IMETHOD GenerateCredentials(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, const PRUnichar *aDomain, const PRUnichar *aUser, const PRUnichar *aPassword, nsISupports **aSessionState, nsISupports **aContinuationState, char **_retval) { return _to GenerateCredentials(aChannel, aChallenge, aProxyAuth, aDomain, aUser, aPassword, aSessionState, aContinuationState, _retval); } \
  170.   NS_IMETHOD GetAuthFlags(PRUint32 *aAuthFlags) { return _to GetAuthFlags(aAuthFlags); } \
  171.  
  172. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  173. #define NS_FORWARD_SAFE_NSIHTTPAUTHENTICATOR(_to) \
  174.   NS_IMETHOD ChallengeReceived(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, nsISupports **aSessionState, nsISupports **aContinuationState, PRBool *aInvalidatesIdentity) { return !_to ? NS_ERROR_NULL_POINTER : _to->ChallengeReceived(aChannel, aChallenge, aProxyAuth, aSessionState, aContinuationState, aInvalidatesIdentity); } \
  175.   NS_IMETHOD GenerateCredentials(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, const PRUnichar *aDomain, const PRUnichar *aUser, const PRUnichar *aPassword, nsISupports **aSessionState, nsISupports **aContinuationState, char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GenerateCredentials(aChannel, aChallenge, aProxyAuth, aDomain, aUser, aPassword, aSessionState, aContinuationState, _retval); } \
  176.   NS_IMETHOD GetAuthFlags(PRUint32 *aAuthFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAuthFlags(aAuthFlags); } \
  177.  
  178. #if 0
  179. /* Use the code below as a template for the implementation class for this interface. */
  180.  
  181. /* Header file */
  182. class nsHttpAuthenticator : public nsIHttpAuthenticator
  183. {
  184. public:
  185.   NS_DECL_ISUPPORTS
  186.   NS_DECL_NSIHTTPAUTHENTICATOR
  187.  
  188.   nsHttpAuthenticator();
  189.  
  190. private:
  191.   ~nsHttpAuthenticator();
  192.  
  193. protected:
  194.   /* additional members */
  195. };
  196.  
  197. /* Implementation file */
  198. NS_IMPL_ISUPPORTS1(nsHttpAuthenticator, nsIHttpAuthenticator)
  199.  
  200. nsHttpAuthenticator::nsHttpAuthenticator()
  201. {
  202.   /* member initializers and constructor code */
  203. }
  204.  
  205. nsHttpAuthenticator::~nsHttpAuthenticator()
  206. {
  207.   /* destructor code */
  208. }
  209.  
  210. /* void challengeReceived (in nsIHttpChannel aChannel, in string aChallenge, in boolean aProxyAuth, inout nsISupports aSessionState, inout nsISupports aContinuationState, out boolean aInvalidatesIdentity); */
  211. NS_IMETHODIMP nsHttpAuthenticator::ChallengeReceived(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, nsISupports **aSessionState, nsISupports **aContinuationState, PRBool *aInvalidatesIdentity)
  212. {
  213.     return NS_ERROR_NOT_IMPLEMENTED;
  214. }
  215.  
  216. /* string generateCredentials (in nsIHttpChannel aChannel, in string aChallenge, in boolean aProxyAuth, in wstring aDomain, in wstring aUser, in wstring aPassword, inout nsISupports aSessionState, inout nsISupports aContinuationState); */
  217. NS_IMETHODIMP nsHttpAuthenticator::GenerateCredentials(nsIHttpChannel *aChannel, const char *aChallenge, PRBool aProxyAuth, const PRUnichar *aDomain, const PRUnichar *aUser, const PRUnichar *aPassword, nsISupports **aSessionState, nsISupports **aContinuationState, char **_retval)
  218. {
  219.     return NS_ERROR_NOT_IMPLEMENTED;
  220. }
  221.  
  222. /* readonly attribute unsigned long authFlags; */
  223. NS_IMETHODIMP nsHttpAuthenticator::GetAuthFlags(PRUint32 *aAuthFlags)
  224. {
  225.     return NS_ERROR_NOT_IMPLEMENTED;
  226. }
  227.  
  228. /* End of implementation class template. */
  229. #endif
  230.  
  231. #define NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX \
  232.     "@mozilla.org/network/http-authenticator;1?scheme="
  233.  
  234. #endif /* __gen_nsIHttpAuthenticator_h__ */
  235.